﻿#region Creditos

/* Autor: Edilberto Sánchez Forero	*/
/* Email: esanchezfo@gmail.com		*/
/* Licencia: LGPL, Software Libre	*/
/* País: Colombia, Bogotá			*/

#endregion

#region Librerias

using System.Net;
using System.Net.Sockets;

#endregion


namespace ESF.Peer
{
	public class DataMessage
	{
		#region Miembros
		
		private byte [] _Data;
		
		private IPEndPoint _To;
		
		private IPEndPoint _From;
		
		private Socket _FromSocket = null;
		
		#endregion
		
		
		#region Propiedades
		
		public IPEndPoint To { get { return _To; } }
		
		public IPEndPoint From { get { return _From; } }
		
		public byte [] Data { get { return _Data; } } 
		
		public Socket FromSocket { get { return _FromSocket; } }
		
		#endregion
		
		
		#region Constructor
		
		private DataMessage () {}
		
		
		public DataMessage (byte [] pData, IPEndPoint pTo)
		{
			_To = pTo;
			_Data = pData;
		}
		
		
		public DataMessage (IPEndPoint pFrom, byte [] pData)
		{
			_From = pFrom;
			_Data = pData;
		}
		
		
		public DataMessage (byte [] pData, IPAddress pToIP, int pToPort)
			: this (pData, new IPEndPoint (pToIP, pToPort)) {}
		
		
		public DataMessage (IPAddress pFromIP, int pFromPort, byte [] pData)
			: this (new IPEndPoint (pFromIP, pFromPort), pData) {}
		
		#endregion
	}
}